/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

#pragma once

#include "DBManager/Common/ServiceMacro.h"
#include "DBManager/IRepository/Input/Element/IPartitionElementCacheRepository.h"
#include "DBManager/IService/Input/Element/IPartitionElementCacheService.h"
#include "DBManager/Service/Input/InputServiceBase.h"

SG_DBMANAGER_NAMESPACE_OPEN

using IRepos = IPartitionElementCacheRepository;

/**
 * @brief    分区结果服务类，用于处理分区号与单元ID映射关系的相关操作
 * @author   wuxingchuang
 * @date     2025.07.24
 */
class DBManager_DECLSPEC PartitionElementCacheService : public IPartitionElementCacheService,
                                                        public InputServiceBase<IPartitionElementCacheRepository>
{
  public:
    explicit PartitionElementCacheService (DBServiceFactory* const dbServiceFactory, IPartitionElementCacheRepository& repos);
    ~PartitionElementCacheService () override;

    FUNCTION_DEFAULT (ServiceDataType)
    FUNCTION_GetAllData (ServiceDataType)

    /**
     * @brief    根据分区ID获取该分区中的所有单元ID
     * @param    partitionId 分区ID
     * @return   该分区中的单元ID列表
     * @author   wuxingchuang
     * @date     2025.07.24
     */
    std::vector<SG::DataStructure::Common::Id> GetElementsByPartition (SG::DataStructure::Common::Id partitionId) override;
};

SG_DBMANAGER_NAMESPACE_CLOSE
